/*********************************************************************
* File: QueuePriority.h
*
* \brief Implementation of a priority queue.
*********************************************************************/
#pragma once

namespace collections {
	/**
	* \class IWorld
	* \brief Priority queue class (smallest item out first).
	*
	* \author Instituto Superior Tecnico de Lisboa, Portugal
	* \author Technical University of Lisbon, Portugal
	* 
	* \author Agentes Autonomos e Sistemas Multiagente
	* \author Autonomous Agents and Multiagent Systems
	* 
	* \version	1.0
	* \date		2006/2007
	**/
class QueuePriority
{
public:
   QueuePriority( int heapSize );
   ~QueuePriority( void );
   inline int Empty ( void ) { return ( m_cSize == 0 ); }
   inline int Size ( void ) { return ( m_cSize ); }
   void Insert( int, float );
   int Remove( void );

private:
   int m_cSize;
   int m_cHeapSize;

   struct tag_HEAP_NODE
   {
      int    Id;
      float  Priority;
   } *m_heap;

   void Heap_SiftDown(int);
   void Heap_SiftUp(void);
};

}